package org.paradise.dms.services.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.paradise.dms.dao.impl.SystemMgrDAOImpl;
import org.paradise.dms.pojo.AllocationInfo;
import org.paradise.dms.services.SystemMgrService;
import org.springframework.stereotype.Service;

import com.dheaven.framework.dao.DaoException;

@Service
public class SystemMgrServiceImpl implements SystemMgrService {
	private static Logger log = Logger.getLogger(SystemMgrServiceImpl.class);
	private SystemMgrDAOImpl systemMgrDAOImpl;

	public List<AllocationInfo> listAllPreassignTypeByPage(int pageSize, int startRow) {
		return systemMgrDAOImpl.listAllPreassignTypeByPage(pageSize, startRow);
	}

	public int getAllPreassignTypeRows() {
		return systemMgrDAOImpl.getAllPreassignTypeRows();
	}

	public String deleltePreassignTypeByID(String allocationid) throws DaoException {
		return systemMgrDAOImpl.deleltePreassignTypeByID(allocationid);
	}

	public SystemMgrDAOImpl getSystemMgrDAOImpl() {
		return systemMgrDAOImpl;
	}

	public void setSystemMgrDAOImpl(SystemMgrDAOImpl systemMgrDAOImpl) {
		this.systemMgrDAOImpl = systemMgrDAOImpl;
	}

	public String insertPreassignType(String preassigntypename,String starttime,String endtime) {
		return systemMgrDAOImpl.insertPreassignType(preassigntypename,starttime,endtime);
	}

	@SuppressWarnings("unchecked")
	public String updatePreassignType(AllocationInfo ai) {
		try {
			systemMgrDAOImpl.update(ai);
			return "更新预分配信息成功！";
		} catch (DaoException e) {
			log.error(e);
		}
		return "更新预分配信息失败！";
	}
}
